﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace ComLib.ComType
{
    public static class ComQCPara
    {
        /// <summary>
        /// 参考照片大小
        /// </summary>
        public static Size ReferSize = new Size(354, 472);

        /// <summary>
        /// 眼睛距离范围
        /// </summary>
        private static RangleUInt EyeDisRangle = new RangleUInt(82, 118);

        /// <summary>
        /// 头高范围
        /// </summary>
        private static RangleUInt HeadHeightRangle = new RangleUInt(306, 401);

        /// <summary>
        /// 脸宽范围
        /// </summary>
        private static RangleUInt FaceWidRange = new RangleUInt(177, 265);

        /// <summary>
        /// 头顶高度范围
        /// </summary>
        private static RangleUInt HeadTopDisRange = new RangleUInt(12, 35);

        /// <summary>
        /// 眼睛距离占比
        /// </summary>
        public static RangleFloat EyeDisPropRange;
        /// <summary>
        /// 脸宽占比
        /// </summary>
        public static RangleFloat FaceWidthPropRange;
        /// <summary>
        /// 头高占比
        /// </summary>
        public static RangleFloat HeadHeightPropRange;
        /// <summary>
        /// 头顶高度占比
        /// </summary>
        public static RangleFloat HeadTopDisPropRange;

        static ComQCPara()
        {
            CalcPropRange();
        }

        /// <summary>
        /// 计算占比
        /// </summary>
        public static void CalcPropRange()
        {
            EyeDisPropRange = new RangleFloat(EyeDisRangle.Min, EyeDisRangle.Max, (uint)ReferSize.Width);
            FaceWidthPropRange = new RangleFloat(FaceWidRange.Min, FaceWidRange.Max, (uint)ReferSize.Width);
            HeadHeightPropRange = new RangleFloat(HeadHeightRangle.Min, HeadHeightRangle.Max, (uint)ReferSize.Width);
            HeadTopDisPropRange = new RangleFloat(HeadTopDisRange.Min, HeadTopDisRange.Max, (uint)ReferSize.Width);
        }

        public static void SetReferSize(Size size)
        {
            ReferSize = size;
        }
    }
}
